use actix_web::web;

use crate::{
    config::get_max_count,
    database::{table, DbPool},
    route::form::link::{LinkForm, NewLinkForm},
    service::{class, ServiceError},
    srv_add, srv_del, srv_get_all_by_foreign_key, srv_get_all_by_slug, srv_upd,
};

srv_add!(add, NewLinkForm, table::link::crud::create);
srv_upd!(upd, LinkForm, table::link::crud::update);
srv_del!(del, table::link::crud::delete);

srv_get_all_by_foreign_key!(
    get_by_tag_id,
    LinkForm,
    table::link::crud::read_count_from_offset_by_tid
);
srv_get_all_by_slug!(
    get_by_tag_slug,
    LinkForm,
    class::tag::get_by_slug,
    id,
    get_by_tag_id
);
